package com.lizhi.note.entity;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Entity
@Table(name = "notebook",
        uniqueConstraints = {
                @UniqueConstraint(columnNames = "notebook")
        })
@EntityListeners(AuditingEntityListener.class)
@Data
@SQLDelete(sql = "UPDATE notebook SET deleted = id WHERE id = ?")
@Where(clause = "deleted = 0")
public class NotebookEntity extends BaseEntity{

    /***
     * 笔记本名称
     */
    @NotBlank
    @Size(max = 20)
    private String notebook;
}
